$(document).ready(function() {
	$(".linkBt").mouseover(function(event) {
		$(this).css('color', 'red');
	});
	$(".linkBt").mouseout(function(event) {
		$(this).css('color', '#666666');
	});
	getWrong(0,0);
	$("#next").click(function(event) {
		getWrong(1,1);
	});
	$("#pre").click(function(event) {
		getWrong(-1,1);
	});
	//返回首页
	$("#imageBt").click(function(event) {
		window.location.href= "./home.html";
	});
});
function getWrong(num,requ){
	$.ajax({
		url: '../question/getPageWrong/' + num +'/'+requ,
		type: 'GET',
		dataType: 'json',
		data: {level: '0'},
		success: function(data){
			console.log("ajax success!!!");
			console.log(data.wList);
			console.log(data.pageNum);
			//显示数据
			handleList(data.wList);
			$("#pageText").html(data.pageNum);
		},
		error: function(){
			console.log("ajax fail!!!");
			alert(errorThrown);
		}
	});
}

function handleList(list){
	var total = list.length;
	for(var i=0;i<total;i++){
		var question = list[i][1];
		var tanswer = list[i][2];
		var answer = list[i][6];
		if(answer == null){
			answer = "空";
		}
		var html = "<span class='textSpan'>"+question+"="+tanswer+"&nbsp;</span>";
		html = html+"<span class='ansSpan'>填写:"+answer+"</span>";
		var idNum = i+1;
		$("#num"+idNum).html(html);
	}
}